package com.leadbank.springboot.example.controller;

import com.leadbank.springboot.example.dal.domain.Product;
import com.leadbank.springboot.example.dal.domain.ProductMapper;
import com.leadbank.springboot.example.dal.domain.User;
import com.leadbank.springboot.example.dal.domain.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.*;

/**
 * Created by hp on 2018/1/8.
 */
@Controller
@RequestMapping(value="/products")     // 通过这里配置使下面的映射都在/users下
public class ProductController {

    @Autowired
    private ProductMapper productMapper;

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
    public List<Product> getUserList() {
        // 处理"/users/"的GET请求，用来获取用户列表
        // 还可以通过@RequestParam从页面中传递参数来进行查询条件或者翻页信息的传递
        List<Product> products = productMapper.getLdbProductList();
        return products;
    }
}
